using System;
using System.Collections.Generic;
using System.Text;

using NHibernate;
using Framework.Library.Domain;
using Framework.Library.Base;

namespace Framework.Library.DAO
{
    public partial interface IPortalPersonaluserManager : IManagerBase<PortalPersonaluser, int>
    {
		// Get Methods
		IList<PortalPersonaluser> GetByCommandID(System.Int32 commandID);
		IList<PortalPersonaluser> GetByPortalID(System.Int32 portalID);
		IList<PortalPersonaluser> GetByUserID(System.Int32 userID);
    }

    partial class PortalPersonaluserManager : ManagerBase<PortalPersonaluser, int>, IPortalPersonaluserManager
    {
		#region Constructors
		
		public PortalPersonaluserManager() : base()
        {
        }
        public PortalPersonaluserManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<PortalPersonaluser> GetByCommandID(System.Int32 commandID)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(PortalPersonaluser));
			
			ICriteria portalCommandCriteria = criteria.CreateCriteria("PortalCommand");
            portalCommandCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", commandID));
			
			return criteria.List<PortalPersonaluser>();
        }
		
		public IList<PortalPersonaluser> GetByPortalID(System.Int32 portalID)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(PortalPersonaluser));
			
			ICriteria portalPortalCriteria = criteria.CreateCriteria("PortalPortal");
            portalPortalCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", portalID));
			
			return criteria.List<PortalPersonaluser>();
        }
		
		public IList<PortalPersonaluser> GetByUserID(System.Int32 userID)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(PortalPersonaluser));
			
			ICriteria portalUserCriteria = criteria.CreateCriteria("PortalUser");
            portalUserCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", userID));
			
			return criteria.List<PortalPersonaluser>();
        }
		
		#endregion
    }
}